package com.example.minemodule.Utils;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

import com.alibaba.android.arouter.launcher.ARouter;
import com.examination.mlib.constants.ARouterConstants;
import com.examination.mlib.interfaceapi.MineApi;
import com.examination.mlib.interfaceapi.MineBackApi;

import java.util.HashMap;

public class MineUtils {
    /**
     * android-rn
     * @param context
     * @param pluginId
     * @param componentName
     */
    public static void push(Context context, String pluginId, String componentName){
        MineBackApi mineBackApi = (MineBackApi) ARouter.getInstance().build(ARouterConstants.MineModuleImpl).navigation();
        mineBackApi.Android2RnPush(context,pluginId,componentName);
    }

    /**
     * rn-android
     * @param context
     * @param pluginId
     * @param componentName
     * @param bundle
     */
    public static void push(Context context, String pluginId, String componentName, Bundle bundle){
        MineBackApi mineBackApi = (MineBackApi) ARouter.getInstance().build(ARouterConstants.MineModuleImpl).navigation();
        mineBackApi.Android2RnPush(context,pluginId,componentName,bundle);
    }


    public static boolean logoutIM(){
        MineBackApi mineBackApi = (MineBackApi) ARouter.getInstance().build(ARouterConstants.MineModuleImpl).navigation();
        return mineBackApi.logoutIM();
    };

    public static void openPickView(HashMap<String,Object> map, Activity activity, MineApi mineApi){
        MineBackApi mineBackApi = (MineBackApi) ARouter.getInstance().build(ARouterConstants.MineModuleImpl).navigation();
        mineBackApi.openPickView(map,activity,mineApi);
    }

}
